import os
import sys

from script.server.Servers import Servers
from script.SyncFromTelewebToFtp import SyncFromTelewebToFtp
from script.util.FileLog import FileLog
from script.util.Print import Print


DST_ROOT_DIR = '/image-sh'
SYNC_LIST = (
    ('/T2-Goose', '%s/T2-Goose' % DST_ROOT_DIR),
    ('/T2-Groot', '%s/T2-Groot' % DST_ROOT_DIR)
)


def main():
    if len(sys.argv) > 1:
        if sys.argv[1] == '--disable-color':
            Print.enable_color(False)  # disable color

    log = FileLog(os.path.join(os.path.dirname(sys.argv[0]), 'log'))
    for sync_info in SYNC_LIST:
        SyncFromTelewebToFtp(Servers.SERVER_T2MSH, sync_info[0],
                             Servers.SERVER_T2MNB, sync_info[1],
                             None).sync_all().close()


if __name__ == '__main__':
    main()
